home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / pascal / facilis.zip / FACILIS.UM < prev    next >
Text File  |  1985-03-05  |  11KB  |  284 lines

  1.  
  2.                          FACILIS User Manual
  3.  
  4. Version 0.20  (preliminary)                               File: FACILIS.UM
  5.                                                           Updated: 15 Feb 85
  6.  
  7.  
  8.  
  9. INTRODUCTION
  10.  
  11.    Facilis is a p-code compiler for an extended subset of the Pascal
  12. programming language.  It is based on the Pascal S compiler of Niklaus Wirth.
  13. It was adapted for the IBMPC by John R. Naleszkiewicz, and is being extended
  14. by Anthony M. Marcy.  It is in the public domain.
  15.    Facilis is written in Pascal and can be compiled by the Turbo Pascal
  16. compiler sold by Borland International.  It cannot compile itself.
  17. For details on how to compile the Facilis source code, see the implementation
  18. manual (file FACILIS.IMP).
  19.    This manual tells you how to run Facilis and describes its features and
  20. limitations.  Knowledge of standard Pascal is assumed; hence emphasis here
  21. will be on deviations from the standard.
  22.    Version 0.20 has been modified with some InLine assembly code to speed
  23. up run time execution.  This has reduced the portability of the source code
  24. to other machines.
  25.  
  26.  
  27.  
  28. CONFIGURATON REQUIREMENTS
  29.  
  30.    Hardware:   IBM PC
  31.                192K memory
  32.                1 disk drive
  33.  
  34.    Software:   PC-DOS 1.1 or later
  35.                file FACILIS.COM
  36.                file FACILIS.000
  37.  
  38.  
  39.  
  40. GETTING STARTED
  41.  
  42.    Run FACILIS from DOS.  FACILIS.COM may be on any drive, but FACILIS.000
  43. must be on the DOS default drive.
  44.    You will be prompted for the name of the file containing your Pascal source
  45. code.  If you enter a filename without an extension, .PAS is assumed.
  46.    Next, you will be asked to name your listing file.  The listing file will
  47. contain a listing of your source code together with any error messages or
  48. diagnostic dumps.  Enter any legal filename, or a carriage return to accept
  49. the default.  DOS device names are legal, too -- CON: to list to the screen,
  50. PRN: for the printer, or NUL for no listing at all.
  51.    Your program will now be compiled.  If it compiles successfully, it will
  52. immediately be run.  If it contains errors, control returns to DOS, and the
  53. listing file will show you what went wrong.
  54.  
  55.  
  56.  
  57. COMPILER DIRECTIVES
  58.  
  59. A comment that has the character '$' as its first character is used to specify
  60. compiler options.  These take the form of a letter followed by a plus sign
  61. (option on) or a minus sign (option off).  All options default to off.
  62. The following options are available:
  63.  
  64.        T+ : Causes the symbol table, the generated p-code, and other internal
  65.             tables to be printed to the list file at the end of compilation.
  66.        S+ : While this directive is in effect, the run time stack is dumped
  67.             to the list file at each entry to a procedure.
  68.  
  69.  
  70.  
  71. THE SOURCE LANGUAGE
  72.  
  73.    The current version of Facilis does not support all of standard Pascal.
  74. Major features not implemented include: files, sets, subrange and enumerated
  75. types, pointers, labels and the GOTO statement, the WITH statement, and
  76. variant records.  A major extension to standard Pascal is dynamic strings.
  77.  
  78. SOURCE TEXT may be prepared with your favorite text editor.  Lines may be up
  79.    to 121 characters long, ending with a CR.  LFs, TABs, and other control
  80.    characters are treated as blanks.
  81.  
  82. COMMENTS may be delimited with either (* and *) or with { and }.  Comments may
  83.    not be nested, but one kind of comment brackets may appear within a comment
  84.    enclosed by the other kind.
  85.  
  86. IDENTIFIERS: Variable names, etc., may be any length (so long as it fits on one
  87.    line) but only the first 10 characters are significant.  The underscore
  88.    character may be used, in addition to the letters and digits.
  89.    Upper and lower case letters are equivalent.
  90.  
  91. INTEGERS range from -32768 to +32767.
  92. REALS may have up to 11 significant digits, with an exponent in the
  93.    range -38 to +38.
  94. STRINGS may have up to 32748 characters.
  95.  
  96. PROGRAM PARAMETERS (in parentheses after the keyword PROGRAM) are optional.
  97.    If present, they are ignored.
  98.  
  99. TYPES: Integer, real, boolean, char, string, array, and record types are
  100.    supported.  File, set, subrange, enumerated, label, and pointer types are
  101.    not implemented.  Elements of arrays and records may be of any type,
  102.    including strings.  Records may not have variant fields.  PACKED records
  103.    are not allowed.
  104.  
  105. PROCEDURES and FUNCTIONS may not be declared FORWARD, nor may they be
  106.    passed as parameters.  Declarations may be nested to a depth of 7.
  107.    All standard builtin functions are supported:
  108.        abs     atan    chr     cos     eof     eoln    exp     ln
  109.        odd     ord     pred    round   sin     sqr     sqrt    succ    trunc
  110.    These string functions are available:
  111.        copy    length  pos     str     val     maxavail
  112.    Builtin procedures supported:
  113.        read    readln  write   writeln
  114.  
  115. WRITE (and WRITELN) output to the screen only, since files are not implemented.
  116.    Maximum output line length is 80.  A CR/LF is inserted automatically if this
  117.    maximum is exceeded.  Default field widths are: integers - 8, reals - 20,
  118.    booleans - 8, chars - 1, strings - their current dynamic length.  Defaults
  119.    may be overridden.  Note that, in Pascal, field widths are minimums, not
  120.    maximums.
  121.  
  122. GET and PUT are not implemented.
  123.  
  124. OPERATORS: &, |, ~ are synonyms for AND, OR, NOT, respectively.
  125.  
  126. CASE statement: maximum number of cases is 30.
  127.  
  128.  
  129.  
  130. STRINGS
  131.  
  132.    All strings in Facilis are dynamic.  That is, they have no fixed length.
  133. A single string may be up to 32748 characters long.  Collectively, strings
  134. may occupy all available memory.
  135.    String literals are denoted in the usual way, enclosed in single quotes.
  136.    A string variable is declared thus:
  137.          VAR s: STRING;
  138. For compatibility with other compilers, it is permitted to specify a length:
  139.          VAR t: STRING[10];
  140. However, the constant is ignored; string t is still fully dynamic.
  141. Strings may occur as elements of arrays and records.
  142.  
  143. COMPATIBILITY: In general, strings are compatible with chars.  I.e., a char
  144.    may be used where a string type is expected, and a string of length 1 may
  145.    be used where a char is expected.  Exceptions are cases that don't make
  146.    much sense: e.g., a string may not be given as the parameter to Ord, and
  147.    a char may not be the second parameter to Pos.
  148.    An ARRAY OF CHAR is assignment-compatible with strings.  A char array
  149.    value may be assigned to any string, which assumes a length equal to the
  150.    size of the array.  A string value may be assigned to a char array, also.
  151.    If the string is too long to fit, it is truncated; if it is too short,
  152.    it is padded with blanks on the right.  String functions other than
  153.    assignment may not be applied directly to a char array; assign the array
  154.    to a string variable first.
  155.  
  156. INDEXING: A string variable may be indexed with an integer expression in
  157.    square brackets, as though it were a char array.  Thus, s[5] is the 5th
  158.    character in string s.  Indexing beyond the current length of the string
  159.    results in a runtime error.  Indexed strings may not appear on the left
  160.    side of assignment statements, nor may they be passed as VAR parameters.
  161.  
  162. RELATIONAL operators =, <>, <=, >=, <, and > may be used to compare strings.
  163.    The collating sequence is ASCII.
  164.  
  165. LENGTH(st) function returns an integer equal to the length of string st.
  166.  
  167. CONCAT function is not implemented.  The + operator is used for concatenation.
  168.  
  169. COPY(st,p,n) function returns the substring of length n, starting at position
  170.    p, of string st.  If p < 1 or p > Length(st), the null string is returned.
  171.    If p+n exceeds Length(st), Copy returns all characters from position p to
  172.    the end of the string.
  173.  
  174. POS(s,t) function returns an integer equal to the position of the first
  175.    occurrence of string s as a substring in string t.  Pos returns 0 if s
  176.    is not contained in t.
  177.  
  178. STR and VAL are implemented as functions rather then as procedures as in some
  179.    other extended Pascals.  Str(n) accepts an integer or real parameter n, and
  180.    returns a string representing the number as it would be printed.
  181.    Val(st) takes a string parameter representing an integer, and returns the
  182.    integer's value.  A separate function Rval(st) does the same for reals.
  183.    String st must not contain leading or trailing blanks.  Val (Rval)
  184.    returns 0 if st does not represent a valid integer (real).
  185.  
  186. INSERT and DELETE are not provided as builtin procedures.  They may readily
  187.    be programmed as ordinary procedures, however.
  188.  
  189. MAXAVAIL function returns an integer value, the size of the largest remaining
  190.    block of string memory.  Value is in paragraphs, 16 bytes to a paragraph.
  191.  
  192.  
  193.  
  194. COMPILER ERROR MESSAGES
  195.  
  196.  0  undefined identifier
  197.  1  attempt at multiple definition
  198.  2  identifier expected
  199.  3  'PROGRAM' expected
  200.  4  ')' expected
  201.  5  ':' expected
  202.  6  syntax error
  203.  7  identifier or 'VAR' expected
  204.  8  'OF' expected
  205.  9  '(' expected
  206. 10  type expected
  207. 11  '[' expected
  208. 12  ']' expected
  209. 13  '..' expected
  210. 14  ';' expected
  211. 15  error in function result type
  212. 16  '=' expected
  213. 17  expression must have BOOLEAN result
  214. 18  invalid type for control variable
  215. 19  type conflict between control variable and expression
  216. 20    (not used)
  217. 21  number too large
  218. 22  '.' expected
  219. 23  invalid expression type following CASE
  220. 24  illegal character
  221. 25  identifier of type CONST expected
  222. 26  array index type conflict
  223. 27  type conflict in declaration of array index bounds
  224. 28  no such array
  225. 29  type identifier expected
  226. 30  undefined type
  227. 31  no such record
  228. 32  BOOLEAN type expected
  229. 33  arithmetic type expected
  230. 34  INTEGER type expected
  231. 35  incompatible operands of relation operator
  232. 36  actual/formal parameter type conflict
  233. 37  variable identifier expected
  234. 38  string expected
  235. 39  wrong number of actual parameters
  236. 40  digit expected
  237. 41  incorrect type
  238. 42  type REAL expected
  239. 43  integer expected
  240. 44  variable or constant expected
  241. 45  variable or procedure identifier expected
  242. 46  incompatible operands of ':='
  243. 47  label type incompatible with selecting expression
  244. 48  incorrect parameter type
  245. 49  store overflow
  246. 50  constant expected
  247. 51  ':=' expected
  248. 52  'THEN' expected
  249. 53  'UNTIL' expected
  250. 54  'DO' expected
  251. 55  'TO' or 'down to' expected
  252. 56  'BEGIN' expected
  253. 57  'END' expected
  254. 58  factor expected
  255. 59  ',' expected
  256. 60  indexed string not allowed here
  257.  
  258.  
  259.  
  260. REFERENCES
  261.  
  262. K. Jensen and N. Wirth, PASCAL USER MANUAL AND REPORT, Springer-Verlag,
  263.    New York.  Accepted as the definition of "standard" Pascal.
  264.  
  265. R.E. Berry, PROGRAMMING LANGUAGE TRANSLATION, John Wiley & Sons, New York.
  266.    Explains the Pascal S compiler in detail.  Includes source code.
  267.  
  268. TURBO PASCAL REFERENCE MANUAL, Borland International, Scotts Valley, CA.
  269.    Reference for the Facilis implementation language.
  270.  
  271.  
  272.  
  273. SUPPORT
  274.  
  275.    The Facilis project is an effort of volunteer amateurs who gather
  276. electronically on the RBBS-PC operated by
  277.               John Naleszkiewicz
  278.               (301)468-1439 (data)
  279.               6:30pm to 8:30am weekdays
  280.               24Hrs weekends.
  281. The latest version is always available for downloading by the public.
  282. All users are encouraged to contribute their comments, suggestions, and
  283. bug reports.
  284. ailable for downl